package com.ruoyi.web.controller.wasterTran;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wasterTran.domain.TConstructionWasteTransportationOrderRecord;
import com.ruoyi.wasterTran.service.ITConstructionWasteTransportationOrderRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 建筑垃圾联单状态跟踪Controller
 * 
 * @author ruoyi
 * @date 2025-01-11
 */
@RestController
@RequestMapping("/wasterTran/record")
public class TConstructionWasteTransportationOrderRecordController extends BaseController
{
    @Autowired
    private ITConstructionWasteTransportationOrderRecordService tConstructionWasteTransportationOrderRecordService;

    /**
     * 查询建筑垃圾联单状态跟踪列表
     */
    @PreAuthorize("@ss.hasPermi('wasterTran:record:list')")
    @GetMapping("/list")
    public TableDataInfo list(TConstructionWasteTransportationOrderRecord tConstructionWasteTransportationOrderRecord)
    {
        startPage();
        List<TConstructionWasteTransportationOrderRecord> list = tConstructionWasteTransportationOrderRecordService.selectTConstructionWasteTransportationOrderRecordList(tConstructionWasteTransportationOrderRecord);
        return getDataTable(list);
    }

    /**
     * 导出建筑垃圾联单状态跟踪列表
     */
    @PreAuthorize("@ss.hasPermi('wasterTran:record:export')")
    @Log(title = "建筑垃圾联单状态跟踪", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TConstructionWasteTransportationOrderRecord tConstructionWasteTransportationOrderRecord)
    {
        List<TConstructionWasteTransportationOrderRecord> list = tConstructionWasteTransportationOrderRecordService.selectTConstructionWasteTransportationOrderRecordList(tConstructionWasteTransportationOrderRecord);
        ExcelUtil<TConstructionWasteTransportationOrderRecord> util = new ExcelUtil<TConstructionWasteTransportationOrderRecord>(TConstructionWasteTransportationOrderRecord.class);
        util.exportExcel(response, list, "建筑垃圾联单状态跟踪数据");
    }

    /**
     * 获取建筑垃圾联单状态跟踪详细信息
     */
    @PreAuthorize("@ss.hasPermi('wasterTran:record:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(tConstructionWasteTransportationOrderRecordService.selectTConstructionWasteTransportationOrderRecordById(id));
    }

    /**
     * 新增建筑垃圾联单状态跟踪
     */
    @PreAuthorize("@ss.hasPermi('wasterTran:record:add')")
    @Log(title = "建筑垃圾联单状态跟踪", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TConstructionWasteTransportationOrderRecord tConstructionWasteTransportationOrderRecord)
    {
        return toAjax(tConstructionWasteTransportationOrderRecordService.insertTConstructionWasteTransportationOrderRecord(tConstructionWasteTransportationOrderRecord));
    }

    /**
     * 修改建筑垃圾联单状态跟踪
     */
    @PreAuthorize("@ss.hasPermi('wasterTran:record:edit')")
    @Log(title = "建筑垃圾联单状态跟踪", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TConstructionWasteTransportationOrderRecord tConstructionWasteTransportationOrderRecord)
    {
        return toAjax(tConstructionWasteTransportationOrderRecordService.updateTConstructionWasteTransportationOrderRecord(tConstructionWasteTransportationOrderRecord));
    }

    /**
     * 删除建筑垃圾联单状态跟踪
     */
    @PreAuthorize("@ss.hasPermi('wasterTran:record:remove')")
    @Log(title = "建筑垃圾联单状态跟踪", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(tConstructionWasteTransportationOrderRecordService.deleteTConstructionWasteTransportationOrderRecordByIds(ids));
    }
}
